use std::rc::Rc;

use dj::{runtime::EnvExt as _, Env};

fn main() {
    let global = dj::Env::root();
    global.set_macro("hello", hello);
    global.eval(dj::parse("(hello 0 1.414 0x10c 0b101 \"Conquer\")").unwrap()).unwrap();
}

fn hello(env: Rc<Env>, mut exprs: Vec<dj::Expr>) -> dj::EvalResult {
    print!("Hello!! values:");
    while let Some(expr) = exprs.pop() {
        print!("{} ", env.eval(expr)?);
    }
    println!();
    Ok(dj::Value::Nil)
}